<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  	<head>
    	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    	<title>Exception</title>
    	<script type="text/javascript">
      		window.onload = calculateSqrt;

      		function calculateSqrt() {
        		var ans = window.prompt("Please enter a number", "");

        		try {
          			if (!ans || isNaN(ans) || ans < 0) 
            			throw new Error("Not a valid number");
	          		alert("The square root of " + ans + " is " + Math.sqrt(ans));
        		} catch (errMsg) {
          			alert(errMsg.message);
        		} finally {
          			alert("I am always executed...");
        		}
      		}
		</script>
  	</head>
  	<body>
	</body>
</html>
